﻿using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Orchard.ContentManagement;
using System.Collections.Generic;

namespace Szmyd.Orchard.Modules.Silverlight.Models
{
    /// <summary>
    /// Content part for embedding Silverlight content.
    /// </summary>
    public class SilverlightPart : ContentPart<SilverlightPartRecord>
    {
        [Required]
        public string Source
        {
            get { return Record.Source; }
            set { Record.Source = value; }
        }

        [Required]
        public string MinRuntimeVersion
        {
            get { return Record.MinRuntimeVersion; }
            set { Record.MinRuntimeVersion = value; }
        }

        public string InitParams
        {
            get { return Record.InitParams; }
            set { Record.InitParams = value; }
        }
        public bool AutoUpdate
        {
            get { return Record.AutoUpdate; }
            set { Record.AutoUpdate = value; }
        }
        public int Width
        {
            get { return Record.Width; }
            set { Record.Width = value; }
        }
        public int Height
        {
            get { return Record.Height; }
            set { Record.Height = value; }
        }

        [HiddenInput(DisplayValue = false)]
        public IEnumerable<object> AvailableFiles { get; set; }

        /// <summary>
        /// Should allow setting Silverlight source (xap) file. 
        /// True by default, False if default setting is set.
        /// </summary>
        [HiddenInput(DisplayValue = false)]
        public bool AllowSourceChange { get; set; }

        /// <summary>
        /// Should allow setting init params on Silverlight object.
        /// True by default, False if default setting is set.
        /// </summary>
        [HiddenInput(DisplayValue = false)]        
        public bool AllowInitParamsChange { get; set; }
    }
}